# Contributor: Kay Thomas <kaythomas@pm.me>
# Maintainer: Kay Thomas <kaythomas@pm.me>
pkgname=fileshelter
pkgver=5.1.2
pkgrel=4
pkgdesc="One-click file sharing web application"
url="https://github.com/epoupon/fileshelter"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake boost-dev libconfig-dev wt-dev samurai"
subpackages="$pkgname-openrc"
pkgusers="fileshelter"
pkggroups="fileshelter"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/epoupon/fileshelter/archive/v$pkgver.tar.gz
	std-optional.patch
	fileshelter.initd
	"
options="!check" # No testsuite

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -dm755 -o fileshelter -g fileshelter \
		"$pkgdir"/var/fileshelter

	install -Dm644 conf/fileshelter.conf \
		"$pkgdir"/etc/fileshelter.conf

	rm "$pkgdir"/usr/share/fileshelter/default.service

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
722786950d2893a8a0da50bb47fd28bd9b9313cca7bbb7ada5fbf79900733bed89cf8171d817d17a52dc0fcf6a2058cd00ced33cda4e0cbfb90d280a89dda718  fileshelter-5.1.2.tar.gz
a1ef635d1f7ee82abc4abf5d1d0253515308923e7443e86faa34be14af1056714c204da5d9a2a3162595ad9395e66f2452df87487dce0f1e97d460c794d9dbbc  std-optional.patch
56051559c91d5c269f8e945445aab3e48de7f3593b7321e6556aee87c458091cfaf14a220a0a8bbb5aa8f682fe1ebd289cfb8dd21b0f3eeb881268f28d84c115  fileshelter.initd
"
